/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.tarifador.dataModel;

import br.com.tarifador.model.Pabx;
import java.util.List;
import javax.faces.model.ListDataModel;
import org.primefaces.model.SelectableDataModel;

/**
 *
 * @author charles
 */
public class PabxTableModel extends ListDataModel<Pabx> implements SelectableDataModel<Pabx> {

    public PabxTableModel() {
    }

    public PabxTableModel(List<Pabx> list) {
        super(list);
    }

    @Override
    public Object getRowKey(Pabx t) {
        return t.getId();
    }

    @Override
    public Pabx getRowData(String rowKey) {
        List<Pabx> lista = (List<Pabx>) getWrappedData();
        for (Pabx pabx : lista) {
            if (pabx.getId().equals(rowKey)) {
                return pabx;
            }
        }
        return null;
    }
}